package com.cssy.yd.basic.service.impl;

import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.byd.acegiext.domain.User;
import com.cssy.yd.basic.dao.BasicPlaceofstorageDAO;
import com.cssy.yd.basic.entity.BasicPlaceofstorageDO;
import com.cssy.yd.basic.service.IBasicPlaceofstorageService;
import com.plat.exception.SyBaseException;
import com.plat.helper.SearchConditions;
import com.plat.helper.SearchResult;
import com.plat.util.IDCodeTypeUtil;


@Service("basichubService")
public class BasicPlaceofstorageServiceImpl implements IBasicPlaceofstorageService{

	
	@Resource(name="basicPlaceofstorageDAO")	
	private BasicPlaceofstorageDAO basicPlaceofstorageDAO;
	
	
	@Override
	public SearchResult findListByExample(SearchConditions scs)
			throws SyBaseException {
		SearchResult rs=new SearchResult(scs);
		List<BasicPlaceofstorageDO>  list=basicPlaceofstorageDAO.find(scs);
		rs.setRecordCount(basicPlaceofstorageDAO.count(scs));
		rs.setResults(list);
		return rs;
	}

	@Override
	public Integer delete(String id, User user) throws SyBaseException {

		basicPlaceofstorageDAO.deleteBasicPlaceofstorageDOByPrimaryKey(id);
	
		return null;
	}

	@Override
	public Integer update(BasicPlaceofstorageDO t, User user) throws SyBaseException {
		t.setDuuser(user.getName());
		t.setDutime(new Date());
		return basicPlaceofstorageDAO.updateBasicPlaceofstorageDO(t);
	}

	@Override
	public BasicPlaceofstorageDO save(BasicPlaceofstorageDO t, User user)
			throws SyBaseException {
		t.setDcruser(user.getName());
		t.setDctime(new Date());
		t.setId(IDCodeTypeUtil.getId());
		basicPlaceofstorageDAO.insertBasicPlaceofstorageDO(t);
		return t;
	}

	@Override
	public BasicPlaceofstorageDO findListById(String id) throws SyBaseException {
		
		return basicPlaceofstorageDAO.findBasicPlaceofstorageDOByPrimaryKey(id);
	}
	
	/**
	 * 验证此仓库是否有此仓位
	 * @param whCode 指定仓库
	 * @param hubCode 指定仓位
	 * @return true 有此仓位 false 无此仓位
	 * @throws SyBaseException
	 */
	@Override
	public boolean validateWhCodeAndHubcode(String whCode,String hubCode) throws SyBaseException {
		
		return false;
	}

	@Override
	public Integer deleteBizRemoved(String id) throws SyBaseException {
		// TODO Auto-generated method stub
		return null;
	}

}
